<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title> 管理中心 -</title>
    <meta name="robots" content="noindex, nofollow" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="styles/general.css" rel="stylesheet" type="text/css" />
    <link href="styles/main.css" rel="stylesheet" type="text/css" />
     <script type="text/javascript" src="js/jquery/uploadify/jquery.min.js"></script>
    <link rel="stylesheet" href="js/zTree/zTreeStyle/zTreeStyle.css" type="text/css" />
    <script type="text/javascript" src="js/zTree/jquery.ztree.core-3.5.js"></script>
    <script type="text/javascript" src="js/zTree/zTreeLoad.js"></script>
</head>
<body>
<s:if test='"app".equals(type)'>
    <h1>
        <span class="action-span"><a href="app_list.do?type=insert&cpid=<s:property value="cpid"/>&categoryparentid=<s:property value="categoryparentid"/>&appName=<s:property value="appName"/>">游戏列表</a></span> <span
            class="action-span1"><a href="mainframe.jsp">
                首页</a> </span><span id="search_id" class="action-span1">- 游戏管理 </span>
    </h1>
    </s:if>
    <s:elseif test='"appversion".equals(type)'>
    <h1>
			<span class="action-span"><a
				href="appversion_index.do?app.appnumber=<s:property value="model.appnumber"/>">平台接入列表</a></span>
			<span class="action-span1"><a href="mainframe.jsp"> 首页</a> </span><span
				id="search_id" class="action-span1">- 平台接入管理 </span>
		</h1>
    </s:elseif>
    <s:elseif test='"channelapk".equals(type)'>
    <h1>
        <span class="action-span"><a href="appchannelapk_list.do">渠道包列表</a></span> <span
            class="action-span1"><a href="mainframe.jsp">
                首页</a> </span><span id="search_id" class="action-span1">- 渠道包管理 </span>
    </h1>
    </s:elseif>
    <!-- start goods form -->
    <div class="tab-div">
        <!-- tab bar -->
        <div id="tabbar-div">
            <p>
                <span class="tab-front" id="general-tab">物料下载</span>
                <s:if test='"app".equals(type)'><span class="tab-front" ><a href="javascript:void(0);" onclick="appshow('update','<s:property value="model.appnumber"/>','wl')">物料上传</a></span></s:if>
                <s:elseif test='"appversion".equals(type)'><span class="tab-front" ><a href="appversion_show.do?type=update&model.id=<s:property value="appversionid"/>&app.appnumber=<s:property value="model.appnumber" />&msg=wl">物料上传</a></span></s:elseif>
                <s:elseif test='"channelapk".equals(type)'><span class="tab-front" ><a href="appchannelapk_show.do?type=update&model.id=<s:property value="channelapkid"/>&msg=wl">物料上传</a></span></s:elseif>
            </p>
        </div>
        <!-- tab body -->
        <div id="tabbody-div">
            <!-- 通用信息 -->
            <div id="div_load"><img width="16px" height="16px" src="images1/20132221211655237947.gif" />正在加载，请稍候！！</div>
            <table style="padding: 0px;margin: 0px;">
            	<tr>
            		<td style="width: 100px;vertical-align: top;border-right: solid 1px #eeeeee;"><div id="tree" class="ztree"></div></td>
            		<td style="vertical-align: top;"><div id="filescreenshotdiv"></div></td>
            	</tr>
            </table> 
            <!-- 通用信息end -->
        </div>
    </div>
<script type="text/javascript">
    var zTreeObj,
	setting = {
		view: {
			selectedMulti: false
		},
		callback:{
			onClick:function(event,treeId,treeNode){
				if(treeNode.id=='0'){
					return;
				}
				var appnumber="",
					appversionnumber="",
					channelapknumber="";
				if(treeNode.appnumber){
					appnumber=treeNode.appnumber;
				}
				if(treeNode.appversionnumber){
					appversionnumber=treeNode.appversionnumber;
				}
				if(treeNode.channelapknumber){
					channelapknumber=treeNode.channelapknumber;
				}
				var params={
						"asmodel.genre":treeNode.geren,
						"asmodel.type":treeNode.type,
						"asmodel.appnumber":appnumber,
						"asmodel.appversionnumber":appversionnumber,
						"asmodel.channelappnumber":channelapknumber
				};
				$.ajax({
					url:"app_getappscreenshot.do?r="+Math.random(),
					data:params,
					type:'get',
					contentType: "application/x-www-form-urlencoded; charset=utf-8", 
					beforeSend:function(){
						$("#filescreenshotdiv").html("<img width=\"16px\" height=\"16px\" src=\"images1/20132221211655237947.gif\" />正在加载，请稍候！！");
					},
					success:function(data){
						$("#filescreenshotdiv").html(data);
					}
				});
			}
		},
		data:{
			simpleData:{
				enable:true,
				idKey:"id",
				pIdKey:"pId",
				rootPId:0
			}
		}
	},
	zTreeNodes = [
		
	];
    $(document).ready(function(){
    	$.ajax({  
            async : false,  
            cache:false,  
            type: 'POST',  
            dataType : "json",  
            url: "app_getztree.do?r="+Math.random(),//请求的action路径  
            data:{'model.appnumber':'<s:property value="model.appnumber" />'},
            contentType: "application/x-www-form-urlencoded; charset=utf-8", 
            error: function () {//请求失败处理函数  
                alert('请求失败');  
            },  
            success:function(data){ //请求成功后处理函数。    
                zTreeNodes = data;   //把后台封装好的简单Json格式赋给treeNodes  
                $("#div_load").hide();
            }  
        }); 
    	zTreeObj = $.fn.zTree.init($("#tree"), setting, zTreeNodes);
	});
    
    function appshow(type,appnumber,msg)
	{
		var url="app_show.do?type="+type+"&model.appnumber="+appnumber;
		if(msg){
			url+="&msg="+msg;
		}
		window.location.href=url;
	}
</script>
	
</body>
</html>
